package impl

import (
	"context"
	"database/sql"
	"demo/p4/demoApi/demo-api/apps/host"
	"demo/p4/demoApi/demo-api/conf"

	"go.uber.org/zap"
)

type HostService interface {
	CreateHost(ctx context.Context, dao *host.Host) (host host.Host, err error)
	QueryHost(ctx context.Context, dao host.HostList) (host []host.Host, err error)
	UpdateHost(ctx context.Context, dao host.Host) (host host.Host, err error)
	DeleteHost(ctx context.Context, dao host.RemoveHost) (host host.Host, err error)
	DescribeHost(ctx context.Context, dao host.RemoveHost) (host host.Host, err error)
}

type HostServiceImpl struct {
	l  zap.Logger
	db *sql.DB
}

// 接口实现的静态检查
var _ HostService = &HostServiceImpl{}

func NewHostServiceImpl() *HostServiceImpl {
	return &HostServiceImpl{
		l:  *zap.L().Named("Host"),
		db: conf.C().MySQL.GetDB(),
	}
}
